import { roomInfo } from "./common"

const log = console.log


class localServer{
    roomsInfo = {}
    receiveHandlers:Array<Function> = []
    room:roomInfo
    initPlayer(receiveHandlers:Array<Function>){
        this.receiveHandlers = receiveHandlers
        this.room = new roomInfo()
    }
    ontext(json){
        log(json)
        this.roomsInfo[json.roomId].dealTask(json).then((data)=>{
            this.receiveHandlers.map(h=>h(data))
        })
    }
}